﻿namespace Innovative.ProXr
{
	public static partial class DirectApi
	{
		/// <summary>
		/// The AD8 Command Set is used to read analog voltages on controllers equipped with a 8-Channel 8/10-Bit Analog 
		/// to Digital Converter. The AD8 Command Set converts a Voltage from 0 to 5 Volts DC into numeric values.
		/// </summary>
		public static class AnalogInputs
		{
			public static class EightBitResolution
			{
				/// <summary>
				/// Reads Analog Input Channel 0 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelOne = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 150)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 1 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelTwo = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 151)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 2 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelThree = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 152)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 3 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelFour = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 153)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 4 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelFive = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 154)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 5 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelSix = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 155)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 6 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelSeven = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 156)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 7 and Returns a 8-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelEight = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 157)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ResponseConverter()
				};

				/// <summary>
				/// Reads All 8 Analog Input Channels and Replies with 8 Bytes indicating the 8-Bit Value of each Analog Input.
				/// </summary>
				public static RelayCommandSet<int[]> ReadAllChannels = new RelayCommandSet<int[]>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 166)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new Int32ArrayResponseConverter()
				};
			}

			public static class TenBitResolution
			{
				/// <summary>
				/// Reads Analog Input Channel 0 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelOne = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 158)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 1 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelTwo = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 159)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 2 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelThree = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 160)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 3 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelFour = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 161)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 4 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelFive = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 162)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 5 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelSix = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 163)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 6 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelSeven = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 164)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads Analog Input Channel 7 and Returns a 10-Bit Value
				/// </summary>
				public static RelayCommandSet<int> ReadChannelEight = new RelayCommandSet<int>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 165)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordResponseConverter()
				};

				/// <summary>
				/// Reads All 8 Analog Input Channels and Replies with 16 Bytes indicating the 10-Bit Value of Each Analog Input.
				/// </summary>
				public static RelayCommandSet<int[]> ReadAllChannels = new RelayCommandSet<int[]>()
				{
					Commands = new RelayCommand[]
					{
						RelayCommand.Command254,
						RelayCommand.CreateReadOnlyCommand(1, 167)
					},
					ExpectedResults = (new RelayByte[0]).CreateRange(0, 255),
					ResponseConverter = new DwordArrayResponseConverter()
				};
			}
		}
	}
}
